from Base import message, intersect, SS_VALID
from DRG import MDCR_DRG

def group(record):
  adrg_zd = ["Z51.000x013","Z51.100x004","Z51.500x001","Z51.500x002","Z51.500x003","Z51.800x953","Z51.800x983"]
  adrg_zd1 = []
  adrg_ss = []
  adrg_ss1 = []
  dept_list = []

  if True and record.zdList[0] in adrg_zd and (not record.ssList or not intersect(record.ssList[0],SS_VALID)):
    message('符合RW2入组条件，匹配规则：主诊断匹配')

    if MDCR_DRG.RW21_group(record):
      return 'RW21'

    if MDCR_DRG.RW25_group(record):
      return 'RW25'
        
    return 'RW2'
  else:
    return ''
    
